{include file="../header.tpl"}

<!-- Loading required javascript -->



<div class="container">

    <div class="content">
        <form action="/post/insert" method="post" enctype="multipart/form-data">
            <fieldset>

                <div class="clearfix {if form_error('title')}error{/if}">
                    <input class="span12 {if form_error('title')}error{/if}" id="title" name="title" type="text"
                           placeholder="Titel" value="{set_value('title')}"/>
                {if form_error('title')}<span class="span12 help-block">{form_error('title')}</span>{/if}
                </div>

                <div class="row">

                    <div class="clearfix span12 {if form_error('content')}error{/if}">
                    {if form_error('content')}<span class="span8 help-inline">{form_error('content')}</span>{/if}
                        <div><textarea class='span12' name="content" id='postContent'
                                       rows="30">{set_value('content')}</textarea></div>
                    </div>

                    <div class="span4 clearfix">

                         <span class="clearfix {if form_error('channel')}error{/if}">
                            <h3>Kanaal</h3>
                        {if form_error('kanaal')}<span class="span8 help-inline">Selecteer een kanaal</span>{/if}
                            <select name='channel' class='span4'>
                                <option value=0>Selecteer een kanaal</option>
                            {foreach from=$channels item=channel}
                                <option value={$channel->getId()} {if set_value('channel') == $channel->getId()}selected{/if}>{$channel->getName()}</option>
                            {/foreach}

                            </select>

                        </span>

                        <span class="clearfix {if form_error('category')}error{/if}">
                            <h3>Categorie</h3>
                        {if form_error('category')}<span class="span8 help-inline">Selecteer een categorie</span>{/if}
                            <select name='category' class='span4'>
                                <option value=0>Selecteer een categorie</option>
                            {foreach from=$headerCategories item=category}
                                <option value={$category->getId()} {if set_value('category') == $category->getId()}selected{/if}>{$category}</option>
                            {/foreach}

                            </select>

                        </span>

                        <h3>Tags</h3>
                        <input id="tag-input" class="span4" type="text" placeholder="Tag"/>

                        <div id="tag-container" class="span4">
                        {if sizeof($this->input->post('tags')) > 1}
                            {foreach from=$this->input->post('tags') item=tag}
                                <span class="label tag-label" onclick="$(this).remove()">{$tag}<input
                                        type="hidden" name="tags[]" value="{$tag}"/></span>
                            {/foreach}
                        {/if}
                        </div>
                        <div class="clearme"></div>

                        <h3>Afbeeldingen</h3>

                        <div id="file-upload-container">

                        </div>

                        <input type="button" id="moreImages" value="Voeg een afbeelding toe" class="btn span4"/>

                        <h3>Video</h3>
                        <input class="span4" type="text" placeholder="Youtube URL" />

                        <button type='submit' class="btn large span4 post-submit">Plaats post &raquo;</button>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>



    <!-- TinyMCE -->
    <script type="text/javascript" src="/public/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
        tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,spellchecker,style,layer,table,advimage,advlink,emotions,iespell,preview,media,searchreplace,print,contextmenu,paste,noneditable,visualchars,nonbreaking",

        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,spellchecker,|,cite,abbr,acronym,|,hr,removeformat,|,sub,sup,|,charmap,iespell,|,preview",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,tablecontrols",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",

        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",

        theme_advanced_resizing : false
        });
    </script>
    <!-- /TinyMCE -->

{include file="../footer.tpl"}